package com.manor.main.adapter;

import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;
import com.manor.common.custom.DrawableTextView;
import com.manor.main.R;
import com.manor.main.bean.VisitorBean;

import java.util.List;

public class VisitorAdapter extends BaseQuickAdapter<VisitorBean, BaseViewHolder> {

    private IAddListListener listener;//声明成员变量

    public interface IAddListListener {//创建抽象类

        void deleteBank();//添加抽象方法，可任意添加多个可带参数如void test(String cibtext);往下加就行
    }

    public VisitorAdapter(int layoutResId, @Nullable List<VisitorBean> data) {
        super(layoutResId, data);

    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, VisitorBean item) {
        RoundedImageView riv_hader = helper.getView(R.id.riv_hader);
        Glide.with(getContext()).load(item.getAvatar()).into(riv_hader);
        TextView tv_time = helper.getView(R.id.tv_time);
        tv_time.setText(item.getAddtime()+"");
        TextView tv_name = helper.getView(R.id.tv_name);
        tv_name.setText(item.getUser_nickname());
        DrawableTextView tvAge = helper.getView(R.id.tv_age);
        TextView tv_id = helper.getView(R.id.tv_id);
        tv_id.setText("淘米号"+item.getSerial_no()+"");

        tvAge.setText(item.getAge()+"");
        if ("1".equals(item.getSex())) {
            tvAge.setLeftDrawable(getContext().getDrawable(R.mipmap.gender_nan));
            tvAge.setBackground(getContext().getDrawable(R.drawable.shape_item_city_bg));
        } else {
            tvAge.setLeftDrawable(getContext().getDrawable(R.mipmap.gender_nv));
            tvAge.setBackground(getContext().getDrawable(R.drawable.shape_item_city_bg));
        }



    }


}